useFixture(default)

def test():
	from Modules import commonBits
	java_recorded_version = '1.5.0_11'

	if window('Protocol Buffer Editor'):
		select('FileChooser', commonBits.sampleDir() + 'protoSales.bin')
		##commonBits.setRecordLayout(select, 'DTAR020')

		click('Edit1')
		select_menu('View>>Sorted Field Tree')
		##select('List', 'sale')
		select('Table', 'store', 'Field,0')
		select('Table', 'department', 'Field,1')
		select('Table', 'cell:Field,1(department)')
		click('Build Tree')
		select('JTreeTable', 'cell:keycode,0(null)')
		assert_p('JTreeTable', 'RowCount', '4')
		select('JTreeTable', 'cell:keycode,0(null)')
		rightclick('JTreeTable', 'store,0')
		select_menu('Expand Tree')
		select('JTreeTable', 'cell: ,2(null)')
		assert_p('JTreeTable', 'RowCount', '9')
		select('JTreeTable', 'cell: ,2(null)')
		rightclick('JTreeTable', 'store,2')
		select_menu('Expand Tree')
		select('JTreeTable', 'cell:keycode,3(69684558)')
		assert_p('JTreeTable', 'Text', '69684558', 'keycode,3')
		select('JTreeTable', 'cell:keycode,4(69684558)')
		assert_p('JTreeTable', 'Content', '[[, , , , , , , ], [, , , , , , , ], [, , , , , , , ], [, , 69684558, 20, 280, 40118, 1, 19000], [, , 69684558, 20, 280, 40118, -1, -19000], [, , 69684558, 20, 280, 40118, 1, 5010], [, , 69694158, 20, 280, 40118, 1, 19000], [, , 69694158, 20, 280, 40118, -1, -19000], [, , 69694158, 20, 280, 40118, 1, 5010], [, , , , , , , ], [, , , , , , , ], [, , , , , , , ], [, , , , , , , ], [, , , , , , , ], [, , , , , , , ]]')

		select('JTreeTable', 'cell:keycode,5(69684558)')
		assert_p('JTreeTable', 'RowCount', '15')
		select('JTreeTable', 'cell:keycode,5(69684558)')
		rightclick('JTreeTable', 'store,9')
		select_menu('Expand Tree')
		select('JTreeTable', 'cell:keycode,10(62684671)')
		assert_p('JTreeTable', 'Text', '62684671', 'keycode,10')
		select('JTreeTable', 'cell:keycode,11(62684671)')
		assert_p('JTreeTable', 'Content', '[[, , , , , , , ], [, , , , , , , ], [, , , , , , , ], [, , 69684558, 20, 280, 40118, 1, 19000], [, , 69684558, 20, 280, 40118, -1, -19000], [, , 69684558, 20, 280, 40118, 1, 5010], [, , 69694158, 20, 280, 40118, 1, 19000], [, , 69694158, 20, 280, 40118, -1, -19000], [, , 69694158, 20, 280, 40118, 1, 5010], [, , , , , , , ], [, , 62684671, 20, 685, 40118, 1, 69990], [, , 62684671, 20, 685, 40118, -1, -69990], [, , , , , , , ], [, , , , , , , ], [, , , , , , , ], [, , , , , , , ], [, , , , , , , ]]')
		select('JTreeTable', 'cell:keycode,10(62684671)')
		assert_p('JTreeTable', 'RowCount', '17')
		select('JTreeTable', 'cell:keycode,10(62684671)')
		rightclick('JTreeTable', 'store,2')
		select_menu('Collapse Tree')
		select('JTreeTable', 'cell:keycode,4(62684671)')
		assert_p('JTreeTable', 'Text', '62684671', 'keycode,4')
		select('JTreeTable', 'cell:keycode,5(62684671)')
		assert_p('JTreeTable', 'Content', '[[, , , , , , , ], [, , , , , , , ], [, , , , , , , ], [, , , , , , , ], [, , 62684671, 20, 685, 40118, 1, 69990], [, , 62684671, 20, 685, 40118, -1, -69990], [, , , , , , , ], [, , , , , , , ], [, , , , , , , ], [, , , , , , , ], [, , , , , , , ]]')
		select('JTreeTable', 'cell:keycode,4(62684671)')
		assert_p('JTreeTable', 'RowCount', '11')
		select('JTreeTable', 'cell:keycode,0(null)')
		rightclick('JTreeTable', 'keycode,0')
		select_menu('Collapse Tree')
		select('JTreeTable', 'cell:keycode,0(null)')
		assert_p('JTreeTable', 'RowCount', '4')
		select('JTreeTable', 'cell:store,0(null)')
		rightclick('JTreeTable', 'store,0')
		select_menu('Expand Tree')
		select('JTreeTable', 'cell:keycode,1(null)')
		assert_p('JTreeTable', 'Content', '[[, , , , , , , ], [, , , , , , , ], [, , , , , , , ], [, , , , , , , ], [, , 62684671, 20, 685, 40118, 1, 69990], [, , 62684671, 20, 685, 40118, -1, -69990], [, , , , , , , ], [, , , , , , , ], [, , , , , , , ], [, , , , , , , ], [, , , , , , , ]]')
		select('JTreeTable', 'cell:keycode,2(null)')
		assert_p('JTreeTable', 'RowCount', '11')
		select('JTreeTable', 'cell:keycode,4(62684671)')
		assert_p('JTreeTable', 'Text', 'cell:keycode,4(62684671)')
		select('JTreeTable', 'cell:keycode,4(62684671)')
		rightclick('JTreeTable', 'store,7')
		select_menu('Expand Tree')
		select('JTreeTable', 'cell:keycode,8(64634429)')
		assert_p('JTreeTable', 'Content', '[[, , , , , , , ], [, , , , , , , ], [, , , , , , , ], [, , , , , , , ], [, , 62684671, 20, 685, 40118, 1, 69990], [, , 62684671, 20, 685, 40118, -1, -69990], [, , , , , , , ], [, , , , , , , ], [, , 64634429, 20, 957, 40118, 1, 3990], [, , 66624458, 20, 957, 40118, 1, 890], [, , 63674861, 20, 957, 40118, 10, 2700], [, , , , , , , ], [, , , , , , , ], [, , , , , , , ]]')
		select('JTreeTable', 'cell:keycode,9(66624458)')
		rightclick('JTreeTable', 'keycode,9')
		select_menu('Edit Record')
		select('JTreeTable', 'cell:keycode,9(66624458)')
		select('Table', 'cell:Data,0(66624458)')
		assert_p('Table', 'Text', '20', 'Data,1')
		select('Table', 'cell:Data,0(66624458)')
		click('BasicInternalFrameTitlePane$NoFocusButton2')
	close()
